<template>
    <div></div>
</template>
<script>
import UTILS from "common/src/utils/utils";
/**
 * 对话框组件
 */
export default {
    
    mounted(){
        this.init()
    },
    created() {},
    data(){
    return{
        //方式1:在需要引入的页面中的data中返回这三个参数
        //方式2：不需要这三个参数，通过路由进行判断
        customGroupid:"",
        customQtype:null,
        customTemplateId:null

    }
    },
    methods: {
        init(){
            //例如
            //   if (this.$route.fullPath.startsWith("/Graduate")) {//方法2：
            //     this.customGroupid = "398033097";
            //     this.customQtype = 2891574;
            //     this.customTemplateId = 4464118;
            // }
            var ui = document.getElementById("YSF-BTN-HOLDER");
             if(ui){
                    ui.style.display="block";
                }else{
                    (function (w, d, n, a, j) {
                        w[n] = w[n] || function () {
                        (w[n].a = w[n].a || []).push(arguments);
                        };
                        j = d.createElement('script');
                        j.async = true;
                        j.src ='https://qiyukf.com/script/ad305c1edf46b83fcbf28b17dd8f9aa9.js?sdkTemplateId=6599110';
                        d.body.appendChild(j);
                        })(window, document, 'ysf');           
        }
              ysf('config', {
                    uid: this.loginUser,
                    name: this.loginUser,
                    //staffid:'123', // 客服id
                    groupid:this.customGroupid, // 客服组id
                    robotShuntSwitch: 1, //开启机器人优先（在指定客服或者客服组的情况下，必须要有此配置项。用户开启机器人优先）
                    qtype: this.customQtype //机器人常见问题模板id
                });
         var openSdk = document.getElementById("YSF-CUSTOM-ENTRY-3");
         if(!openSdk) return    
                 openSdk.click = function () {
                        ysf('open', {
                            // templateId:this.customTemplateId//模板统一配置在src后缀sdkTemplateId
                                    })
                }
    }
}

}
</script>
<style lang="scss">
</style>
